//
//  ApiTaskBase.h
//  ApiBase
//
//  Created by Liam on 12-10-3.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

// 子类 .mm 文件必须添加如下代码
// id ret##TYPE = [ApiTaskFactory regClientTask:TYPE taskClass:[{子类} class]];

@class HttpConn;
@class GDataXMLElement;

@protocol IApiTaskBehavior
- (NSString *)_getServerUrl;
- (NSString *)_getUrl;
- (NSString *)_getRequestURI;
- (NSString *)_getRequestParams;
- (BOOL)_ignoreParamKey:(NSString *)key;
- (NSData *)_getHTTPBody;
- (NSInputStream *)_getHTTPStreamBody;
- (NSString *)_getMethod;
- (NSDictionary *)_getHeaders;
- (id)_connectionDelegate;
- (NSOperationQueuePriority)_queuePriority;
- (double)_threadPriority;
- (BOOL)_needSecurity;
- (void)_dealWithResponse:(NSData *)data withError:(NSError *)error;
- (NSError *)_checkEnvBeforeProcess;
@end

@interface ApiTaskBase : NSOperation <IApiTaskBehavior> {
@private
	NSInteger _taskType;
	NSDictionary* _params;
	id _delegate;
	id _context;
	
	HttpConn* _httpConn;
}

@property (nonatomic, assign) NSInteger taskType;
@property (nonatomic, retain) NSDictionary* params;
@property (nonatomic, retain) id delegate;
@property (nonatomic, retain) id context;

@end
